local onefile = require("onefile")
SERVER_IP = "47.104.21.25"
--SERVER_IP = "192.168.88.1"
SERVER_PORT = 22122
--CLIENT_DEBUG = true
enet = require "enet"
math.randomseed(os.time())
--__TESTING = true
BASEPATH = SERVER and "client/" or ""
require ("lib/autobatch")
class=require ("lib/middleclass")
delay= require ("lib/delay")
tween = require ("lib/tween")
bump = require ("lib/bump")
bitser = require ("lib/bitser")
sock = require ("lib/sock")
require "scr/net"
   
Base = require "object/base"
Tank = require "object/tank"
Bullet = require "object/bullet"
Ding = require "object/ding"
Map = require "object/map"
Item = require "object/item"
HQ = require "object/headquarter"
require "game_mode"
WindowMaxSize = 720
GlobalScale = love.window.getDPIScale()*love.graphics.getHeight()/WindowMaxSize

Cam = require "lib/gamera"
texture = require("scr/texture"):init()
sound = require("scr/sound"):init()
suit = require ("lib/suit")
gamestate= require ("lib/gamestate")
require "scr/user"
OS = love.system.getOS( )


--OS = "Android"   
--profile = require("lib/profile"):new()
function love.load() 
    if OS == "Windows" then
        love.window.setMode(720,720,{fullscreen = false})
    elseif OS == "Android" then
        --love.window.setFullscreen(true)
    end
    net:clientInit()
    texture:testInit()
    gameState={}
        for _,name in ipairs({
"gm_select",
"localgame",
"login",
"mapeditor",
"netgame",
"register",
"result",
"room_select",
"setting",
"title",
"local_gm_select",
"classicgame"}) do
        gameState[name]=require("scene."..name)
    end
    gamestate.registerEvents()
    gamestate.switch(gameState.title)

    delay:new(1,function()
        if onefile then onefile() end
    end)
end

function love.update(dt)
    net:update(dt)
    delay:update(dt)
end

function love.draw()
   --suit.draw()
end

function love.textinput(t)
    suit.textinput(t)
end

function love.keypressed(k)
    suit.keypressed(k)
end
